<link href="/admins/css/adminshare.css" rel="stylesheet" type="text/css" />
<link href="/admins/css/yundan.css" rel="stylesheet" type="text/css" />
<style>
    .qudao dl{clear: both}
</style>
<div class="admin_nrtop">
    <div class="yundantopleft">
        <div class="yundancz">
            <div class="nui-toolbar-item">
                <div class="nui-btn ">
                    <a href="/admini/visiting/index" class="nui-btn-text"><span>&lt;&lt;</span>返回</a>
                </div>
            </div>                    
            <div class="nui-toolbar-item">
                <?php if($this->vsDetail->Interior != Application_Model_VisitingServer::Interior_WaitPay){ ?>
                <div class="nui-btn ">
                    <a href="javascript:abnormal();" class="nui-btn-text">取件异常</a>
                </div>
                <div class="nui-btn" id="statusAll">
                    <a href="javascript:void()" class="nui-btn-text rxl" id="statusChange">修改前台状态<i></i></a>
                    <div class="ztlist" style="display:none;" id="statusBox">
                        <ul>
                                <?php if(Application_Model_VisitingServer::getStatusAll()){ foreach (Application_Model_VisitingServer::getStatusAll() as $key => $eccomp) { ?>
                                    <li><a href="javascript:editStatus(<?php echo $key; ?>)" name="<?=$this->vsDetail->id?>" id="editStatus<?=$key?>"><?php echo $eccomp; ?></a></li>
                                <?php }} ?>
                        </ul>
                    </div>
                </div>

                <!--下拉选中状态class="nui-btn nuion"-->
                <div class="nui-btn" id="interiorAll">
                    <a href="javascript:void()" class="nui-btn-text rxl" id="interiorChange">修改后台状态<i></i></a>
                    <div class="ztlist" style="display:none;" id="interiorBox">
                        <ul>
                               <?php if(Application_Model_VisitingServer::getInteriorAll()){ foreach (Application_Model_VisitingServer::getInteriorAll() as $key => $eccomp) { ?>
                                    <li><a href="javascript:editInterior(<?php echo $key; ?>)" name="<?=$this->vsDetail->id?>" id="editInterior<?=$key?>"><?php echo $eccomp; ?></a></li>
                                <?php }} ?>
                        </ul>
                    </div>
                </div>
                <?php if($this->vsDetail->WayId){ ?>
                <div class="nui-btn ">
                    <a target="_blank" href="/admini/managewaybill/print/id/<?=$this->vsDetail->WayId?>" class="nui-btn-text">打印清单</a> 
                </div>
                <?php } ?>
                <div class="nui-btn ">
                    <a href="javascript:recourier(<?=$this->vsDetail->id?>);" class="nui-btn-text">取消</a>
                </div>
                <?php } ?>
                <div class="nui-btn ">
                    <a href="javascript:deleteById(<?=$this->vsDetail->id?>);" class="nui-btn-text">删除</a>
                </div>
                <div class="nui-btn ">
                    <a href="javascript:interNote(<?=$this->vsDetail->id?>);" class="nui-btn-text">内部备注</a>
                </div>
            </div>     
        </div>
        <div class="yundangrinfo">
            <p>取件编号：<?=$this->vsDetail->visitingNo?$this->vsDetail->visitingNo:"暂无"?><span>|</span>用户：<a href="/admini/manageuser/userdetail/id/<?=$this->vsDetail->UserInfo->id?>"><?=$this->vsDetail->UserInfo->nikename?$this->vsDetail->UserInfo->nikename:"暂无"?></a><span>|</span>仓库号：<a href="/admini/managestore/index/history/2/quick/<?=$this->vsDetail->UserInfo->storeno?>"><?=$this->vsDetail->UserInfo->storeno?$this->vsDetail->UserInfo->storeno:"暂无"?></a><span>|</span>提交时间：<?=$this->vsDetail->dateCreated?$this->vsDetail->dateCreated:"暂无"?><span>|</span>付款时间：<?=$this->vsDetail->datePaid?$this->vsDetail->datePaid:"暂无"?></p>
        </div>
    </div>
    <div class="yundantopright">
        <p>用户ID：<?=$this->vsDetail->UserInfo->id?$this->vsDetail->UserInfo->id:"暂无"?></p>
    </div>
    <div class="buzhou" style="clear:both">
        <div class="bzbox" style="display:<?php if($this->vsDetail->isWay == 1){echo "block";}else{echo "none";} ?>;">
            <table>
                <tr>
                <?php
                    $interiorall = $this->vsDetail->InteriorCorrect2;
                    foreach ($interiorall as $key => $interiorval) {
                        $vsLog = Application_Model_WayLog::getByWayIdInteriorType($this->vsDetail->id, $key, Application_Model_WayLog::Type_Visiting);
                        ?>
                        <td <?php echo $vsLog ? 'class="bz_wanl"' : ""; ?>>
                            <div class="bzloading">
                                <div class="dian"><?php echo ($vsLog ? '<a href="javascript:void(0)"><i></i><span>'.$interiorval[1] : '<i></i><span>'.$interiorval[0]).'</span></a>'; ?></div>
                                <?php if ($vsLog) { ?>
                                    <div class="bzxiangbox" style="display: none;">
                                        <div class="xjiantou"></div>
                                        <div class="xianginfo">
                                            <ul>
                                                <li><label>处理时间：</label><em><?php echo $vsLog->dateCreated; ?></em></li>
                                                <li><label>责任人：</label><em><?php echo $vsLog->operator; ?></em></li>
                                            </ul>
                                        </div>
                                    </div>
                                <?php } ?>
                            </div>
                        </td>
                    <?php } ?>
                <!--流程全完class="bz_wanr"-->
                        <td <?php if($this->vsDetail->Interior == Application_Model_VisitingServer::Interior_Launch){ echo "class=bz_wanr"; } ?>></td>
                </tr>
            </table>
        </div>
        
        <div class="bzbox" style="display:<?php if($this->vsDetail->isWay != 1){echo "block";}else{echo "none";} ?>;">
            <table>
                <tr>
                <?php
                    $interiorall = $this->vsDetail->InteriorCorrect;
                    foreach ($interiorall as $key => $interiorval) {
                        $vsLog = Application_Model_WayLog::getByWayIdInteriorType($this->vsDetail->id, $key, Application_Model_WayLog::Type_Visiting);
                        ?>
                        <td <?php echo $vsLog ? 'class="bz_wanl"' : ""; ?>>
                            <div class="bzloading">
                                <div class="dian"><?php echo ($vsLog ? '<a href="javascript:void(0)"><i></i><span>'.$interiorval[1] : '<i></i><span>'.$interiorval[0]).'</span></a>'; ?></div>
                                <?php if ($vsLog) { ?>
                                    <div class="bzxiangbox" style="display: none;">
                                        <div class="xjiantou"></div>
                                        <div class="xianginfo">
                                            <ul>
                                                <li><label>处理时间：</label><em><?php echo $vsLog->dateCreated; ?></em></li>
                                                <li><label>责任人：</label><em><?php echo $vsLog->operator; ?></em></li>
                                            </ul>
                                        </div>
                                    </div>
                                <?php } ?>
                            </div>
                        </td>
                    <?php } ?>                                          
                <!--流程全完class="bz_wanr"-->
                <td <?php if($this->vsDetail->interior == Application_Model_VisitingServer::Interior_Complete){ echo "class=bz_wanr"; } ?>></td>
                </tr>
            </table>
        </div>
        
        <div class="bzxiang">
      </div>

    </div>
</div>    
<div class="yundan_top">
        <table class="yunxinxi">
        <tr>
                <td class="ydleft">
                <div class="zhuangtai">
                    <i></i><h1><?=$this->vsDetail->InteriorName?><em>(<?php if($this->vsDetail->isWay == 1){ echo "直发国外";}else{ echo "存入仓库";} ?>)</em>
                        <?php if($this->vsDetail->problem == Application_Model_VisitingServer::Problem_AppearProblem){ ?><em>[问题]</em><?php } ?></h1>
                    <span>[前台状态：<?=$this->vsDetail->StatusName?>]</span>
                </div>
                <div class="shouli">
                        <?php if($this->vsDetail->interior == Application_Model_VisitingServer::Interior_Processing){ ?>
                            <a class="anvbotton5" href="javascript:void();" name="<?=$this->vsDetail->id?>" id="accepted"><span>受理</span></a>
                        <?php } ?>
                </div>
            </td>
                <td class="ydtopline">
                <div class="zhtailan">
                        <label>状态栏：</label>
                    <div class="ydtishi">
                        <?php if($this->vsDetail->problem == Application_Model_VisitingServer::Problem_AppearProblem){ ?><a class="ts6" href="javascript:abnormal();" title="异常">异常</a><?php }else{ ?><a class="ts0" href="#" title="正常">正常</a><?php } ?>
                    </div>
                </div>
            </td>
        </tr>
        <tr>
                <td class="ydleft">
                                        <table>
                        <tr>
                        <td class="xleft" style="width:130px;">国内物流号：</td>
                        <td class="xlright"><?=$this->vsDetail->inlandLogistics?$this->vsDetail->inlandLogistics:"暂无"?></td>
                        <td class="xleft" style="width:130px;">预估国内体积：</td>
                        <td class="xlright"><?php echo $this->vsDetail->estimateVolume?$this->vsDetail->estimateVolume/1000:"0";?>kg</td>
                    </tr>
                        <tr>
                        <td class="xleft">顺丰订单号：</td>
                        <td class="xlright"><?=$this->vsDetail->sfNo?$this->vsDetail->sfNo:"暂无"?></td>
                        <td class="xleft">国内重量：</td>
                        <td class="xlright"><?php echo $this->vsDetail->estimateWeight?$this->vsDetail->estimateWeight/1000:"0";?>kg</td>
                    </tr>
                        <tr>
                        <td class="xleft">运输类型：</td>
                        <td class="xlright"><?=$this->express?$this->express->name:"暂无"?></td>
                        <td class="xleft">长宽高：</td>
                        <td class="xlright"><?php echo $this->vsDetail->packageSize?$this->vsDetail->packageSize:"0*0*0"; ?></td>
                    </tr>
                        <tr>
                        <td class="xleft">包裹名称：</td>
                        <td class="xlright" colspan="3"><?=$this->vsDetail->waresName?$this->vsDetail->waresName:"暂无"?></td>
                    </tr>
                     <tr>
                        <td class="xleft">国内运费：</td>
                        <td class="xlright"><?=$this->vsDetail->inlandMoney?"￥".$this->vsDetail->inlandMoney."元(预估)":"暂无"?></td>
                        <?php if($this->cnShipFree > 0){ ?>
                            <td class="xleft">国内运费：</td>
                            <td class="xlright"><?=$this->cnShipFree?"￥".$this->cnShipFree."元(实际)":"暂无"?></td>
                        <?php }else{ ?>
                            <td class="xleft">国内运费：</td>
                            <td class="xlright"><?=$this->vsDetail->ActualCnShipFee?"￥".$this->vsDetail->ActualCnShipFee."元(实际)":"暂无"?></td>
                        <?php } ?>    
                    </tr>
                    <tr>
                        <td class="xleft">国际运单号：</td>
                        <td class="xlright"><?php echo $this->wayBillItem?"<a href='/admini/managewaybill/billaccep/id/".$this->wayBillItem->id."' style='color:#125FB7;'>".$this->wayBillItem->billNo."</a>":"暂无"?></td>                        
                        <td class="xleft"><?php if($this->vsDetail->isWay == 1){ ?>预付款：<?php }else{ ?>保证金：<?php } ?></td>
                        <td class="xlright"><em class="jiner">￥<?php if($this->vsDetail->isWay == 1){echo $this->vsDetail->advanceMoney?$this->vsDetail->advanceMoney:"0";}else{echo $this->vsDetail->guaranteeFee?$this->vsDetail->guaranteeFee:"0";}?>元</em></td>
                    </tr>
                </table>
            </td>
                <td class="ydtopline sdq" rowspan="2">
                                        <table class="yddizhi">
                        <tr>
                        <td class="dzl">取件姓名：</td>
                        <td><?=$this->vsDetail->inlandUser?$this->vsDetail->inlandUser:"暂无"?></td>
                    </tr>
                        <tr>
                        <td class="dzl">国内省份：</td>
                        <td><?=$this->vsDetail->CityByCityId?$this->vsDetail->CityByCityId->name:"暂无"?></td>
                    </tr>
                        <tr>
                        <td class="dzl">市级：</td>
                        <td><?=$this->vsDetail->TownBy?$this->vsDetail->TownBy->name:"暂无"?></td>
                    </tr>
                    <tr>
                        <td class="dzl">详细地址：</td>
                        <td><?=$this->vsDetail->inlandAddress?$this->vsDetail->inlandAddress:"暂无"?></td>
                    </tr>
                        <tr>
                        <td class="dzl">联系电话：</td>
                        <td><?=$this->vsDetail->inlandPhone?$this->vsDetail->inlandPhone:"暂无"?></td>
                    </tr>
                    <tr>
                        <td class="dzl">收件地址：</td>
                        <td>宝安区石岩街道塘头大道石岩山城物流园2栋2楼悠奇仓库<?php echo substr(strrev($this->vsDetail->id),0,-1);?>室</td>
                    </tr>
                </table>
            </td>
        </tr>
        <tr>
                <td class="ydleft">
                <table>
                <tr <?php echo $this->Visiting ? "" : "style='display:none;'" ?>>
                            <td colspan="3" style="padding-left: 20px;color: #c00;">
                               风险审核：暂停此用户的所有服务！
                            </td>
                </tr>
                <tr <?php echo $this->visitingpay ? "" : "style='display:none;'" ?>>
                            <td colspan="3" style="padding-left: 20px;color: #c00;">
                               客户第一次国际信用卡支付，24小时风险审核后自动解除服务限制！ 
                            </td>
                </tr>
                        <tr>
                        <td class="xleft">内部备注：</td>
                        <td>
                            <?php if($this->modelRemark): ?>
                            <?php echo $this->modelRemark->content ?>
                            <?php elseif($this->vsDetail->interiorRemark): ?>
                            <?php echo $this->vsDetail->interiorRemark ?>
                            <?php else: ?>
                            无
                            <?php endif; ?>
                        </td>
                    </tr>
                           <tr>
                        <?php if ($this->vsDetail->UserInfo->remark) { ?>
        <div class="youqiliuyan">
            <div class="lanmu">
                <h2>用户备注</h2>
            </div>
            <div class="yqly">
            <?php echo "<p><b>用户备注：</b>" . $this->vsDetail->UserInfo->remark . "</p>"; ?>

            </div>
        </div>
    <?php } ?>
                    </tr>
                </table>
            </td>
        </tr>
    </table>
</div>

<?php if(($this->vsDetail->interior == Application_Model_VisitingServer::Interior_Payfreight || $this->vsDetail->interior == Application_Model_VisitingServer::Interior_InStore) && $this->vsDetail->isWay != 1){ ?>
<div class="lcbox">
     <table class="lcks">        
        <?php if($this->jiesuanLink){?>
        <tr>
                <td class="lcleft"><p>结算款链接</p>
                </td>
                <td>
                <div class="qudao">                    
                    <div class="lctijiao">                        
                        <?php echo 'http://www.uuch.com/pay/index/index/type/9/id/'.$this->jiesuanLink->id;//echo 'http://www.uuch.com/pay/paying/id/'.$this->jiesuanLink->id."9"; ?>         
                        　&nbsp;&nbsp;&nbsp;&nbsp;客户需补交国内运费 ￥<?php echo $this->cnShipFree-$this->vsDetail->guaranteeFee; ?>元
                    </div>                    
                </div>
                <div class="lctijiao">
                        <a href="javascript:paid(<?=$this->vsDetail->id?>);" class="anvbotton5" style="float:left;margin-left: 240px;"><span>客服已扣款点击结算</span></a>
                </div>    
            </td>
        </tr>
        <?php }else{ ?>
        <tr>
                <td class="lcleft"><p>结算</p>
                </td>
                <td>
                <div class="qudao">
                    <?php if($this->vsDetail->guaranteeFee >= $this->cnShipFree){echo "客户的保证金大于实际国内运费, 需退还客户  ￥".($this->vsDetail->guaranteeFee-$this->cnShipFree)."元";}else{echo "客户的保证金小于实际国内运费，客户需补交国内运费 ￥".($this->cnShipFree-$this->vsDetail->guaranteeFee)."元";} ?>
                        <br/>
                    <div class="lctijiao">
                        <a onclick="var that = this;setTimeout(function(){that.removeAttribute('href');that.onclick=that=null;}, 0);return true;" href="javascript:jiesuan(<?=$this->vsDetail->id?>)" class="anvbotton5" style="float:left;"><span><?php if($this->vsDetail->guaranteeFee >= $this->cnShipFree){ echo "确认退款";}else{echo "生成付款链接";} ?></span></a>
                    </div>
                </div>
            </td>
        </tr>
       <?php } ?>
    </table>
</div>
<?php } ?>

<div class="yunshu" style="display:<?php if($this->vsDetail->interior == Application_Model_VisitingServer::Interior_Confrimed&&$this->vsDetail->problem != Application_Model_VisitingServer::Problem_AppearProblem){ echo "block";}else{ echo "none";}?>">
<div class="lanmu">
        <h2>通知顺丰取件</h2>
</div>
<div class="lcbox">
    <table class="lcks">
        <tr>
                <td class="lcleft"><p>顺丰取件</p>
                </td>
                <td>
                <div class="qudao">
                    <dl>
                        <dt>顺丰定单号：</dt>
                        <dd>
                                <div class="textbox"><input class="textinput w250" type="text" name="sfNo" id="sfNo"/></div>
                        </dd>
                    </dl>  
                    <div class="lctijiao">
                        <a href="javascript:informsf(<?=$this->vsDetail->id?>)" class="anvbotton5" style="float:left;"><span>通知顺丰取件</span></a>
                    </div>
                </div>
            </td>
        </tr>
    </table>
   </div>
</div>
    
<div class="yunshu" style="display:<?php if($this->vsDetail->interior == Application_Model_VisitingServer::Interior_InformDelivery&&$this->vsDetail->problem != Application_Model_VisitingServer::Problem_AppearProblem){ echo "block";}else{ echo "none";}?>">
<div class="lanmu">
        <h2>顺丰已取件</h2>
</div>
<div class="lcbox">
        <table class="lcks">
        <tr>
                <td class="lcleft"><p>顺丰已取件</p>
                </td>
                <td>
                <div class="qudao">
                    <dl>
                        <dt>国内物流单号：</dt>
                        <dd>
                                <div class="textbox"><input class="textinput w250" type="text" id="inlandLogistics" name="inlandLogistics"/>
                        </dd>
                    </dl>  
                    <div class="lctijiao">
                        <a href="javascript:delivery(<?=$this->vsDetail->id?>)" class="anvbotton5" style="float:left;"><span>设为顺丰已取件</span></a>
                    </div>
                </div>
            </td>
        </tr>
    </table>
   </div>
</div>
    

    
<div class="yunshu" style="display:<?php if($this->vsDetail->isWay == 1&&$this->vsDetail->problem != Application_Model_VisitingServer::Problem_AppearProblem){echo "block";}else{echo "none";} ?>;">
<div class="lanmu">
        <h2>发起国际运单流程</h2>
</div>
<div class="lcbox">
        <table class="lcks" style="display:<?php if($this->vsDetail->interior == Application_Model_VisitingServer::Interior_InStore){ echo "block";}else{ echo "none";}?>;">
        <tr>
                <td class="lcleft"><p>打包</p></td>
                <td>
                <div class="qudao">
                        <dl>
                        <dt>结算重量：</dt>
                        <dd>
                                <div class="textbox"><input class="textinput w250" type="text" name='actualWeight' id='actualWeight'/></div><span class="ksd">kg</span>
                        </dd>
                    </dl>
                        <dl>
                        <dt>包裹尺寸：</dt>
                        <dd>
                                <div class="chicun"><input class="textinput w30" type="text" id="length" name="length" /><i>X</i><input class="textinput w30" id="width" name="width" type="text" /><i>X</i><input class="textinput w30" type="text" id="height" name="height"/><span>CM</span></div>
                        </dd>
                    </dl>
                        <dl>
                        <dt>结算体积：</dt>
                        <dd>
                                <div class="textbox"><input class="textinput w250" type="text" name='actualVolume' id='actualVolume'/></div><span class="ksd">kg</span>
                        </dd>
                    </dl>
                    <dl>
                        <dt>结算金额：</dt>
                        <dd>
                            <ul>
                                <li><div class="textbox"><input class="textinput w80" type="text" name="amount" id="amount"/></div><span class="ksd">元</span></li>
                            </ul>
                        </dd>
                    </dl>
                    <div class="lctijiao">
                        <input type="hidden" name="arrearsMoney" id="arrearsMoney" value="0"/>
                        <a href="javascript:packaging(<?php echo $this->vsDetail->id; ?>)" class="anvbotton5"><span>设为已打包</span></a>
                    </div>
                </div>
            </td>
        </tr>
    </table>
    <div class="qingdan" style="display:<?php if($this->vsDetail->interior == Application_Model_VisitingServer::Interior_InStore){ echo "block";}else{ echo "none";}?>;">
        <div class="lanmu">
            <h2>物品清单</h2><?php $arrlocation = @explode(",",$this->vsDetail->locationName);?>
            <p><label>所占库位：</label>
                <?php foreach($arrlocation as $key => $valname){ 
                    if($valname != ""){
                        echo $valname;
                        if($key < count($arrlocation)-2){
                            echo "<span>|</span>";
                        }
                    }
                }?>
            </p>
        </div>
        <div class="wupintable">
            <div class="biaotbody">
                <table>
                    <tr>
                        <th class="li8"><div class="lileft">物品编号</div></th>
                        <th class="li35"><div class="lileft">物品信息</div></th>
                        <th class="li9"><div class="lileft">快递公司</div></th>
                        <th class="li9"><div class="lileft">快递号</div></th>
                        <th class="li7"><div class="lileft">来源</div></th>
                        <th class="li8"><div class="lileft">物品净重(kg)</div></th>
                        <th class="li8"><div class="lileft">预估体积(kg)</div></th>
                        <th class="li8"><div class="lileft">所在库位</div></th>
                        <th class="li8"><div class="lileft">拣货状态</div></th>
                    </tr>
                </table>
            </div>
            <div class="table">
                <table>
                    <?php
                        if ($this->storedetail != '') {
                            foreach ($this->storedetail as $storeItem) {
                                $Item = $storeItem->StoreIdByItem;
                                
                                ?>
                                <tr>
                                    <td class="li8">
                                        <div class="lileft bianhao">
                                            <p><a href="/admini/managestore/storedetail/id/<?php echo $Item->id; ?>"  target="_blank"><?php echo $Item->barcode; ?></a></p>
                                            <span><?php echo $Item->createdate; ?></span>
                                        </div>
                                    </td>
                                    <td class="li35">
                                        <div class="lileft wpinfo">
                                            <div class="spic">
                                                <a href="<?= $this->cdn ?><?= !is_int(strpos('big',$Item->imageFile))?('/big'.$Item->imageFile):($Item->imageFile) ?>"  target="_blank">
                                                    <img src="<?php echo $this->cdn; ?><?php echo $Item->image; ?>" /></a>
                                            </div>
                                            <div class="wpinfobox">
                                                <h2><a href="/admini/managestore/storedetail/id/<?php echo $Item->id; ?>"  target="_blank"><?php echo $Item->productName; ?></a></h2>
                                                <p>属性：<?php echo $Item->ItemTypeName; ?></p>
                                            </div>
                                        </div>
                                    </td>
                                    <td class="li9">
                                        <div class="lileft"><?php echo $Item->logisticsName; ?></div>
                                    </td>                                
                                    <td class="li9">
                                        <div class="lileft"><?php echo $Item->logistics;?></div>
                                    </td>   
                                    <td class="li7">
                                        <div class="lileft"><?php echo $Item->intype; ?></div>
                                    </td>                             
                                    <td class="li8">
                                        <div class="lileft"><?php echo $Item->weight / 1000; ?></div>
                                    </td>                             
                                    <td class="li8">
                                        <div class="lileft"><?php echo $Item->volumeWeight / 1000; ?></div>
                                    </td>                             
                                    <td class="li8">
                                        <div class="lileft"><?php echo $Item->locationNo?$Item->locationNo:"无"; ?></div>
                                    </td>                             
                                    <td class="li8">
                                        <div class="lileft"><?php echo $Item->InteriorName."(内部)<br><span style='color:#c0c'>$Item->StatusName(前台)</span>"; ?></div>
                                    </td>                             
                                </tr>
                        <?php } }?>
                </table>
            </div>    
        </div>
    </div>
    
    
    <table class="lcwc" style="display:<?php if($this->vsDetail->interior > Application_Model_VisitingServer::Interior_InStore){ echo "block";}else{ echo "none";}?>;">
        <tr>
                <td class="lcleft">
                    <p class="yixz"><?php if($this->vsDetail->interior > Application_Model_VisitingServer::Interior_Pack){ echo "<i></i>";}?>审单流程</p>
            </td>
            <td>
                <div class="qudao">
                        <dl>
                        <dt>重量：</dt>
                        <dd><?php echo $this->packWeight?$this->packWeight/1000:0; ?> kg</dd>
                    </dl>
                        <dl>
                        <dt>体积：</dt>
                        <dd>
                             <?php echo $this->packVolume?$this->packVolume/1000:0; ?> kg 
                        </dd>
                        <?php if($this->packSize->description != "NaN*NaN*NaN"){ ?>
                        <dt>长宽高：</dt>                        
                        <dd>
                             <?php echo $this->packSize->description; ?>
                        </dd>
                        <?php } ?>
                    </dl>
                        <dl>
                        <dt>运单费用：</dt>
                        <dd>
                                <ul>
                                <li class="num">￥<?php echo $this->shipFee; ?></li>
                            </ul>
                        </dd>
                    </dl>
                    <?php if($this->vsDetail->interior == Application_Model_VisitingServer::Interior_Pack){ ?>
                    <div class="lctijiao">
                        <a href="javascript:inspections(<?php echo $this->vsDetail->id; ?>);" class="anvbotton5"><span>设为已审单</span></a>
                    </div>
                    <?php } ?>
                </div>
            </td>
        </tr>
    </table>
    <?php if($this->vsDetail->interior == Application_Model_VisitingServer::Interior_Inspections || $this->vsDetail->interior == Application_Model_VisitingServer::Interior_Payingmoney){ ?>
    <?php if($this->payLink && ((string)($this->shipFee - $this->vsDetail->advanceMoney) == (string)($this->payLink->repayMoney))){ ?>
    <table class="lcwc" id="linkBox">
        <tr>
                <td class="lcleft">
                  <p>补交款链接</p>
            </td>
            <td>
                <div class="qudao">
                    <dl>
                        <?php echo '客户需补交 ￥'.$this->payLink->repayMoney."元"; ?>
                    </dl>
                    <dl id="payLink">
                        <?php echo $this->payLink->getPayLink(Application_Model_PayBill::TYPE_REPAY_LINK); ?>
                    </dl>                    
                </div>
                <div class="lctijiao">
                    <a href="javascript:manualpaid(<?php echo $this->vsDetail->id; ?>);" class="anvbotton5" style="float:left;margin-left:120px;"><span>已扣款启动国际运单</span></a>
                </div>
            </td>
        </tr>
    </table>
    <?php }else{ ?>
    <table class="lcwc">
        <tr>
                <td class="lcleft">
                  <p>补交款链接</p>
            </td>
            <td>
                <div class="qudao">
                    <dl>
                        需要补交款，请点击生成补交款链接 <a onclick="var that = this;setTimeout(function(){that.removeAttribute('href');that.onclick=that=null;}, 0);return true;" href="javascript:getpaylink(<?php echo $this->vsDetail->id; ?>);"><button style='width:120px;height:30px;'>生成补交款链接</button></a>
                    </dl>
                </div>
            </td>
        </tr>
    </table>
    <?php }} ?>
  </div>
 </div>
                
</div>
</div>

<div class="tanchuang" style="display:none;">
    <div class="nui-msgbox">
        <div class="nui-msgbox-hd" id="wayProblem">问题包裹</div>
        <div class="nui-msgbox-hd" id="uuchInterior" style="display:none;">取消上门取件</div>
        <div class="nui-msgbox-hd" id="interNote" style="display:none;">内部备注</div>
        <a class="nui-msgbox-close" title="关闭"><b></b></a>
    </div>
    <div class="wt_top">
    	<div class="wt_nav">
            <ul>
            	<li class="wt_on"><a href="javascript:void(0)" id="problem">问题沟通</a></li>
            	<li ><a href="javascript:void(0)" id="dispose">处理与进度</a></li>
            </ul>
        </div>
    </div>
    <div class="wenti_box" id="problemComm">
        <div class="wt_center">
            <?php
                if($this->issuedetail){
                    foreach($this->issuedetail as $problemVal){ ?>
                    <div class="<?php echo $problemVal->issuetype == 1?"wt_uuch":"wt_kehu"; ?>">
                        <h2><?php echo $problemVal->issuetype == 1?"悠奇客服":'回复人：<a href="/admini/manageuser/userdetail/id/'.$this->vsDetail->userId.'" target="_blank">'.$this->vsDetail->UserInfo->nikename.'</a>'; ?>
                            <span><?php echo $problemVal->dateCreated;?></span></h2>
                        <p><?php echo htmlspecialchars($problemVal->content);?></p>
                    </div>
            <?php } } ?>
        </div>
            <div class="wt_caozuo">
                <textarea name="content" cols="" rows="" id="content"></textarea><a class="wt_liuyan" href="javascript:message(<?php echo $this->vsDetail->id; ?>);"><span>留言</span></a>
            </div>
    </div>
    <div class="wenti_box" id="interiorRemark" style="display:none;">
        
        <form method="post" action="/admini/managewaybill/addinteriorremark/id/<?php echo $this->billall->id; ?>?_rf=<?= urlencode($this->referer) ?>" id="formremark">
            <div class="wt_caozuo">
                <textarea name="interiorcontent" cols="" rows="" id="interiorcontent"></textarea><a class="wt_liuyan" href="javascript:$('#formremark').submit();"><span>留言</span></a>
            </div>
        </form>
    </div>
    <div class="wenti_box2"  style="display:none;">
            <div class="wttj">
                <input class="textinput w140" type="text" value="<?php echo date("Y-m-d H:i:s");?>" id='crdate' name='crdate'/>
                <input class="textinput w300" type="text" id='schedule' name='schedule' /><a class="anvbotton5" href="javascript:progress(<?php echo $this->vsDetail->id; ?>)" id='affirmjindu'><span>确认</span></a>
            </div>
	<div class="wenti_jindu">
            <table>
                <?php 
                if($this->scheduledetail){
                    foreach($this->scheduledetail as $key => $operateVal){ ?>
                    <tr <?php echo $key==0?'class="jd_on"':"";?>>
                        <td class="wtjd_z"><p><?php echo $operateVal->dateCreated;?><i></i></p></td>
                        <td><?php echo $operateVal->content;?></td>
                    </tr>
                <?php } }?>
            </table>
        </div>
        <div class="wenticaoz">
            <?php if($this->problemWay && $this->problemWay->status != "" && $this->problemWay->status != Application_Model_ProblemWay::Problem_Cancel){ ?>
            <ul>
            	<li><a class="anvbotton6" href="javascript:cancel(<?php echo $this->vsDetail->id;?>)"><span>取消问题</span></a></li>
            	<li><a class="anvbotton6" href="javascript:lost(<?php echo $this->vsDetail->id;?>);"><span>快件丢失</span></a></li>
            </ul>
            <?php }  ?>
        </div>
    </div>
    <div class="wenti_box3"  style="display:none;">
        <table width="100%" style="margin-top:48px;">
            <tr height="32px"><td align="right" style="font-size:18px;">退还客户金额：</td><td> ￥ <font color="red"><?php if($this->vsDetail->isWay == 1){echo $this->vsDetail->advanceMoney;}else{echo $this->vsDetail->guaranteeFee;}; ?></font> 元</td></tr>
            <tr><td>&nbsp;</td><td><input type="hidden" name="vsId" id="vsId" value="<?php echo $this->vsDetail->id; ?>"/>
                </td><input type="hidden" name="refunds" id="refunds" value="<?php if($this->vsDetail->isWay == 1){echo $this->vsDetail->advanceMoney;}else{echo $this->vsDetail->guaranteeFee;}; ?>"></tr>
            <tr height="32px;"><td colspan="2" align="center"><button style="width:120px;height:32px;" id="drawback">确认退款并取消</button></td></tr>
        </table>
    </div>
    <div class="wenti_box4"  style="display:none;">
        <table style="width: 80%;margin:auto;margin-top: 38px;">
            <tr>
                <td class="askl">备注：</td>
                <td><textarea name="interiorNote" id="interiorNote" cols="60" rows="9"><?php if($this->modelRemark): ?><?php echo $this->modelRemark->content ?><?php elseif($this->vsDetail->interiorRemark): ?><?php echo $this->vsDetail->interiorRemark ?><?php endif; ?></textarea></td>
            </tr>
        </table>
        <div class="neirboxok" style="width: 25%;margin:auto;margin-top: 16px;">
            <a class="anvbotton" href="javascript:remark(<?php echo $this->vsDetail->Id; ?>)"><span>确认提交</span></a>
        </div>
    </div>
</div>
<div class="houtai_overlay" style="display:none;"></div>
<!--center-->
<script type="text/javascript">
$(".dian").mouseenter(function(){
    $(this).next("div").attr("style","display:block;");
});
$(".bzloading").mouseleave(function(){
    $(".bzloading .bzxiangbox").attr("style","display:none;");
});    
function cancel(id){
    if(confirm("确定要取消吗?")){
        $.post(
            '/admini/visiting/cancel',
            {'id':id},
            function(data){
                if(data === 1){
                    alert("成功取消！");
                    location.reload();
                }else{
                    alert("取消失败！");
                }    
            }
        ,'json');
    }
}    
    
$('#accepted').click(function(){
    var id = $('#accepted').attr('name');
    $.post(
        '/admini/visiting/hear',
        {'id':id},
        function(data){
            if(data === 1){
                alert("受理成功！");
                location.reload(); 
            }else{
                alert("只有未受理状态才能受理");
            }    
        }
    ,'json');            
});
$('#statusChange').click(function(){
    $('#statusBox').show();
});
$('#statusAll').mouseleave(function(){
    $('#statusBox').hide();
});
$('#interiorChange').click(function(){
    $('#interiorBox').show();
});
$('#interiorAll').mouseleave(function(){
    $('#interiorBox').hide();
});
function editStatus(status){
    var id = $('#editStatus'+status).attr("name");
    var name = $('#editStatus'+status).html();
    if(confirm("您确定要修改成"+name)){
        $.post(
            '/admini/visiting/changestatus',
            {'id':id,'status':status},
            function(data){
                if(data === 1){
                    alert("修改前台状态成功！");
                    location.reload(); 
                }else{
                    alert("修改状态失败！");
                }    
            }
        ,'json');
    }
}

function editInterior(interior){
    var id = $('#editInterior'+interior).attr("name");
    var name = $('#editInterior'+interior).html();
    if(confirm("您确定要修改成"+name)){
        $.post(
            '/admini/visiting/changeinterior',
            {'id':id,'interior':interior},
            function(data){
                if(data === 1){
                    alert("修改后台状态成功！");
                    location.reload(); 
                }else{
                    alert("修改状态失败！");
                }    
            }
        ,'json');
    }
}

function informsf(id){
    var sfNo = $('#sfNo').val();
    if(sfNo === ""){
        alert("顺丰单号不能为空！");
        return;
    }
    $.post(
        '/admini/visiting/informsf',
        {'id':id,'sfNo':sfNo},
        function(data){
            if(data === 1){
                alert("操作成功！");
                location.reload(); 
            }else if(data === 2){
                alert("顺丰单号不能为空");
            }else{
                alert("只有受理状态才能通知顺丰取件");
            }    
        }
    ,'json');
}

function delivery(id){
    var inlandLogistics = $('#inlandLogistics').val();
    /*if(inlandLogistics === ""){
        alert("国内运单号不能为空！");
        return;
    }*/
    $.post(
        '/admini/visiting/delivery',
        {'id':id,'inlandLogistics':inlandLogistics},
        function(data){
            if(data === 1){
                alert("操作成功！");
                location.reload();
            }else{
                alert("只有通知顺丰取件状态下才能设为已收件");
            }    
        }
    ,'json');
}

$('#height,#width,#length').blur(function(){
    var id = <?php echo $this->vsDetail->id; ?>;
    var length = $('#length').val();
    var width = $('#width').val();
    var height = $('#height').val();
    if(length && width && height){
        if(isNaN(length)){
            alert("长必须是数值！");
            return;
        }
        if(isNaN(width)){
            alert("宽必须是数值！");
            return;
        }
        if(isNaN(height)){
            alert("高必须是数值！");
            return;
        }
        var description = length*width*height/5000;
        $('#actualVolume').val(description);
        var actualWeight = $('#actualWeight').val()?$('#actualWeight').val():0;
        var actualVolume = $('#actualVolume').val()?$('#actualVolume').val():0;
        if(isNaN(actualWeight)){
            alert("重量必须是数值！");
            return;
        }
        if(isNaN(actualVolume)){
            alert("体积必须是数值！");
            return;
        }
        var weight = 0;
    //    if(parseInt(actualWeight) > parseInt(actualVolume)){
    //        weight = actualWeight;
    //    }else{
    //        weight = actualVolume;
    //    }
        $.post(
            '/admini/visiting/cultfee',
            {'id':id,'weight':actualWeight,'volume':actualVolume},
            function(data){
                $('#amount').val(data.money);
                if(data.arrearsMoney>0){
                    $("#arrearsMoney").val(data.arrearsMoney);
                }
            }
        ,'json');
    }
});

$('#actualWeight,#actualVolume').blur(function(){
    var id = <?php echo $this->vsDetail->id; ?>;
    var weight = 0;
    var actualWeight = $('#actualWeight').val()?$('#actualWeight').val():0;
    var actualVolume = $('#actualVolume').val()?$('#actualVolume').val():0;
//    if(parseInt(actualWeight) > parseInt(actualVolume)){
//        weight = actualWeight;
//    }else{
//        weight = actualVolume;
//    }
    $.post(
        '/admini/visiting/cultfee',
        {'id':id,'weight':actualWeight,'volume':actualVolume},
        function(data){
            $('#amount').val(data.money);
            if(data.arrearsMoney>0){
                $("#arrearsMoney").val(data.arrearsMoney);
            }
        }
    ,'json');
});

function packaging(id){
    var actualWeight = $('#actualWeight').val()?$('#actualWeight').val():0;
    var actualVolume = $('#actualVolume').val()?$('#actualVolume').val():0;
    var amount = $('#amount').val()?$('#amount').val():0;
    if(actualWeight === 0 && actualVolume === 0){
        alert("重量不能为空！");
        return;
    }
    var length = parseInt($('#length').val());
    var width = parseInt($('#width').val());
    var height = parseInt($('#height').val());
    var arrearsMoney = $("#arrearsMoney").val();
    $.post(
        '/admini/visiting/packvisiting',
        {'id':id,'weight':actualWeight,'volume':actualVolume,'length':length,'width':width,'height':height,'shipFee':amount,'arrearsMoney':arrearsMoney},
        function(data){
            if(data === 1){
                alert("设为已打包！");
                location.reload(); 
            }else if(data === 2){
                alert("（出错）----只有入库状态下才能打包");
            }else{
                alert("操作失败！");
            }    
        }
    ,'json');
}

function inspections(id){
    $.post(
        '/admini/visiting/inspections',
        {'id':id},
        function(data){
            if(data.type === 1){             
                alert("设为已审单！");
                location.reload();                
            }else if(data.type === 0){
                alert("只有打包状态下，才能审单！");
            }else if(data.type === 10){
                alert("没有关联运单");
            }else{
                alert("设为已审单！");
                location.reload(); 
            }
        }
    ,'json');
}

function abnormal(){
    $("div.houtai_overlay").attr("style","display:block;");
    $('#uuchInterior').hide();
    $('#interNote').hide();
    $('div.wenti_box3').hide();
    $('div.wenti_box4').hide();
    $("div.tanchuang").attr("style","display:block;");
    $("#problem").click();
}
$("#issue").live("click",function(){
    $("div.houtai_overlay").attr("style","display:block;");
    $("div.tanchuang").attr("style","display:block;");
    $("#problem").click();
});
$(".nui-msgbox-close").live("click",function(){
    $("div.houtai_overlay").attr("style","display:none;");
    $("div.tanchuang").attr("style","display:none;");
});
$("#problem").live("click",function(){
    $(".wt_top").attr("style","display:block");
    $(".wt_nav ul li").attr("class","");
    $(this).parents("li").attr("class","wt_on");
    $(".wenti_box2").attr("style","display:none");
    $("#interiorRemark").attr("style","display:none");
    $("#problemComm").attr("style","display:block");
    $("#wayProblem").attr("style","display:block");
});
$("#dispose").live("click",function(){
    $(".wt_top").attr("style","display:block");
    $(".wt_nav ul li").attr("class","");
    $(this).parents("li").attr("class","wt_on");
    $(".wenti_box").attr("style","display:none");
    $(".wenti_box2").attr("style","display:block");
    $(".wenti_box3").attr("style","display:none");
    $(".wenti_box4").attr("style","display:none");
    $("#wayProblem").attr("style","display:block");
});
function getpaylink(id){
    $.post(
        '/admini/visiting/getpaylink',
        {'id':id},
        function(data){
            if(data.type === 1){               
               location.reload();
            }else{
                alert("操作失败！");
            }
        }
     ,'json');
}

function message(id){
    var content = $('#content').val();
    var myDate = new Date();
    $.post(
        '/admini/visiting/affirmvsproblem',
        {'id':id,'content':content},
        function(data){
            if(data === 1){
                alert("留言成功！");
                location.reload();
                //$(".wt_center").html($('.wt_center').html()+"<div class='wt_uuch'><h2>悠奇客服:<span></span>"+myDate.toLocaleString()+"</h2><p>"+content+"</p></div>");
            }else if(data === 2){
                alert("内容为空！");
            }else if(data === 0){
                alert("问题取消或者已发国际运单不能标问题");
            }
        }
    ,'json');
}

function progress(id){
    var crdate = $('#crdate').val();
    var schedule = $('#schedule').val();
    $.post(
        '/admini/visiting/affirmschedule',
        {'id':id,'crdate':crdate,'schedule':schedule},
        function(data){
            if(data === 1){
                alert("增加进度成功！");
                location.reload();
            }else{
                alert("问题取消或者已发国际运单不能再标注处理进度！");
            }
        }
    ,'json');
}

function lost(id){
    if(confirm("确认要设为快件丢失！")){
        $.post(
           '/admini/visiting/lost',
           {'id':id},
           function(data){
               if(data === 1){
                   alert("操作成功！");
                   location.reload(); 
               }else if(data === 2){
                   alert("只有先标记问题包裹，才能设置快件丢失");
               }else{
                   alert("无该上门取件记录");
               }
           }
        ,'json');
    }
}

/*取消快件*/
function recourier(id){
    $('div.tanchuang').show();
    $("div.houtai_overlay").attr("style","display:block;");
    $('#wayProblem').hide();
    $('#uuchInterior').show();
    $('#interNote').hide();
    $('div.wt_top').hide();
    $('#problemComm').hide();
    $('div.wenti_box').hide();
    $('div.wenti_box2').hide();
    $('div.wenti_box3').show();
    $('div.wenti_box4').hide();
}

$('#drawback').click(function(){
    if(confirm("确认退款？")){
        var vsId = $('#vsId').val();
        var refunds = $('#refunds').val();
        $.post(
            '/admini/visiting/cancelservice',
            {'vsId':vsId,'refunds':refunds},
            function (data){
                if(data === 1){
                    alert("操作成功！");
                    location.reload();
                }else if(data === 2){
                    alert("已经取消的不能退款！");
                }else{
                    alert("操作失败！");
                }
            }
        ,'json');
    }
});

function jiesuan(id){
    if(confirm("确定要结算？")){
        $.post(
            '/admini/visiting/jiesuan',
            {'id':id},
            function(data){
                if(data.type === 1){
                    alert("结算成功！");
                    location.reload();
                }else if(data.type === 3){
                    alert("退款金额不能大于100元");
                    location.reload();
                }else{
                    alert("需要用户补交国内运费，请复制付款链接给用户付款");
                    location.reload();
                }
            }
        ,'json');
    }
}

function deleteById(id){
    if(confirm("确认要删除！")){
        $.post(
            '/admini/visiting/deletebyid',
            {'id':id},
            function (data){
                if(data === 1){
                    alert("删除成功！");
                    location.href="/admini/visiting/index/";
                }else{
                    alert("删除失败！");
                }
            }
        ,'json');
    }
}

function paid(id){
    if(confirm("确定已扣款并且结算？")){
        $.post(
            '/admini/visiting/settlement',
            {'id':id},
            function(data){
                if(data.type === 1){
                    alert("结算成功！");
                    location.reload();
                }else{
                    alert("结算失败！");
                    location.reload();
                }
            }
        ,'json');
    }
}

function manualpaid(id){
    if(confirm("确定已扣款并且启动国际运单？")){
        $.post(
             '/admini/visiting/manualpaid',
             {'id':id},
             function (data){
                if(data.type === 1){
                    alert("启动国际运单成功！");
                    location.reload();
                }else{
                    alert("启动国际运单成功！");
                    location.reload();
                }
             }
        ,'json');
    }
}

function interNote(){
    $('div.tanchuang').show();
    $("div.houtai_overlay").attr("style","display:block;");
    $('#wayProblem').hide();
    $('#uuchInterior').hide();
    $('#interNote').show();
    $('div.wt_top').hide();
    $('#problemComm').hide();
    $('div.wenti_box').hide();
    $('div.wenti_box2').hide();
    $('div.wenti_box3').hide();
    $('div.wenti_box4').show();
}

function remark(id){
    var interiorNote = $('#interiorNote').val();
    $.post(
        '/admini/visiting/remark',
        {'id':id,'interiorNote':interiorNote},
        function (data){
           if(data === 1){
               alert("添加备注成功！");
               location.reload();
           }else{
               alert("添加备注失败！");
               location.reload();
           }  
        }
    ,'json');
}

</script>

